<!DOCTYPE html>
<html lang='en'>
<head>
  <meta charset='UTF-8'>
  <meta http-equiv='X-UA-Compatible' content='IE=edge'>
  <meta name='viewport' content='width=device-width, initial-scale=1.0'>
  <title>React Document</title>
</head>
<body>
  <div id='test'></div>
  <div id='test2'></div>
  <script src='../js/react.development.js'></script>
  <script src='../js/react-dom.development.js'></script>
  <script src='../js/babel.min.js'></script>
  <script type='text/babel'>
    class Person extends React.Component {
      render() {
        return (
          <ul>
            <li>姓名:{this.props.name}</li>
            <li>性别:{this.props.gender}</li>
            <li>年龄:{this.props.age}</li>
          </ul>
        )
      }
    }
    function Person2 (props) {
      console.log(props);
      return (
          <ul>
            <li>姓名:{props.name}</li>
            <li>性别:{props.gender}</li>
            <li>年龄:{props.age}</li>
          </ul>
        )
    }
    const test = document.getElementById('test')
    ReactDOM.render(<Person name="张三" gender="男" age="23"/>, test)
    ReactDOM.render(<Person2 name="李四" gender="男" age="23"/>, test2)
  </script>
</body>
</html>
<!--
  类式组件通常不写constructor
  可以通过 类的静态属性
  defaultProps指定默认属性值
  propTypes指定属性类型 是否必传[引入prop-types库进行限制]

  函数式组件 可以接收参数 通过参数获取props
  可以通过 类名.defaultProps指定默认属性值
  类名.propTypes指定属性类型 是否必传
 -->